home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-19 | 3.3 KB | 180 lines | [TEXT/CWIE] |
- // CSliders.cp -- window methods
- // Created 3/19/96 12:49 PM by AppMaker
-
- #include "CSliders.h"
-
- #include <UReanimator.h>
- #include <URegistrar.h>
- #include <LStream.h>
- #include <LStdControl.h>
- #include "CGadgetsData.h"
- #include "CmdCodes.h"
-
- #define PPob_SlidersID 202
- #define RidL_SlidersID 202
-
- Boolean CSliders::sIsRegistered = false;
-
- //----------
- void
- CSliders::RegisterClass ()
- {
- URegistrar::RegisterClass ('Slis', (ClassCreatorFunc)CSliders::CreateSlidersStream);
-
- // register the pane classes we use
-
- sIsRegistered = true;
- }
-
- //----------
- CSliders*
- CSliders::CreateSliders(
- LCommander *inSuperCommander,
- CGadgetsData *inData)
- {
- if (!sIsRegistered) {
- RegisterClass ();
- }
-
- CSliders *window;
-
- window = (CSliders *)LWindow::CreateWindow(PPob_SlidersID, inSuperCommander);
- window->ConnectToData (inData);
-
- return window;
- }
-
- //----------
- // This is the function you register with URegistrar to create a
- // CSliders from a resource
-
- CSliders*
- CSliders::CreateSlidersStream(
- LStream *inStream)
- {
- return (new CSliders(inStream));
- }
-
- //----------
- CSliders::CSliders()
- {
- }
-
- //----------
- CSliders::CSliders(
- LStream *inStream)
- : LWindow(inStream)
- {
- }
-
- //----------
- CSliders::~CSliders()
- {
- }
-
- //----------
- // This member function gets called once the containment hierarchy that contains
- // this pane has been built. It gives us a chance to get data members for
- // interesting subviews, and to do other operations now that our subviews exist.
- void
- CSliders::FinishCreateSelf()
- {
- mVerticalScroll = (LStdControl *)FindPaneByID ('Verl');
- mSliderScroll = (LStdControl *)FindPaneByID ('Slir');
- mSpinnerScroll = (LStdControl *)FindPaneByID ('Spir');
- mHorizontalScroll = (LStdControl *)FindPaneByID ('Horl');
- mPictSliderScroll = (LStdControl *)FindPaneByID ('Picr');
-
- UReanimator::LinkListenerToControls(this, this, RidL_SlidersID);
- // the purpose is to "connect" self to whatever controls
- // that we want to "listen" to
-
- // any additional initialization for your window:
-
- }
-
- //----------
- void
- CSliders::ConnectToData (CGadgetsData *inData)
- {
- mData = inData;
- inData->AddListener (this);
- }
-
- //----------
- void
- CSliders::ListenToMessage(
- MessageT inMessage,
- void *ioParam)
- {
- switch (inMessage) {
-
- default:
- break;
- }
- }
-
- //----------
- Boolean
- CSliders::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the commands
-
- default:
- cmdHandled = LWindow::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- //----------
- void
- CSliders::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LWindow::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- //----------
- Boolean
- CSliders::FocusDraw()
- {
- Boolean focused = LView::FocusDraw();
-
- if (focused) {
- AuxWinHandle awHndl;
- CTabHandle awCTable;
- ColorSpec contentSpec;
-
- GetAuxWin(GetMacPort(), &awHndl);
- awCTable = (**awHndl).awCTable;
- contentSpec = (**awCTable).ctTable [wContentColor]; // should search vs. index
- ::RGBBackColor(&contentSpec.rgb);
- }
-
- return focused;
- }
-